package com.nxn.core.model;

import java.util.Arrays;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;


/**
 * Models a Person who registers.
 * @author Michael
 *
 */

@Entity
@Table(name = "t_person")
public class Person extends IdEntity {
	
    private String firstName;
    private String lastName;
    private String sport;
    private String gender;
    private String residency;
    private boolean over21;
    private String [] carModels = new String[0];
 
	@Column(name = "firstName")
	public String getFirstName() {
		return firstName;
	}

	@Column(name = "lastName")
	public String getLastName() {
		return lastName;
	}

	@Column(name = "sport")
	public String getSport() {
		return sport;
	}

	@Column(name = "gender")
	public String getGender() {
		return gender;
	}

	@Column(name = "residency")
	public String getResidency() {
		return residency;
	}

	@Column(name = "over21")
	public boolean getOver21() {
		return over21;
	}
	@Transient
	public String[] getCarModels() {
		return carModels;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public void setSport(String sport) {
		this.sport = sport;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	public void setResidency(String residency) {
		this.residency = residency;
	}

	public void setOver21(boolean over21) {
		this.over21 = over21;
	}

	public void setCarModels(String[] carModels) {
		this.carModels = carModels;
	}

	public String toString() {
        return "First Name: " + getFirstName() + " | " +
        " Last Name:  " + getLastName() + " | " +
        " Favorite Sport: " + getSport() + " | " +
        " Gender: " + getGender() + " | " +  
        " Residency: " + getResidency() + " | " +
        " Over 21: " + getOver21()  + " | " +
        " Car models: " + Arrays.asList( getCarModels() ) ;
    }
}
